﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KPIS.GERP.GIMS.DAL
{
    public class ConvertNullable
    {
        #region convert object
        public Nullable<int> ConvertNullInt(Object o)
        {
            Nullable<int> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<int>)Convert.ToInt32(o)));
            return result;
        }

        public Nullable<double> ConvertNullDouble(Object o)
        {
            Nullable<double> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<double>)Convert.ToDouble(o)));
            return result;
        }

        public Nullable<DateTime> ConvertNullDateTime(Object o)
        {
            Nullable<DateTime> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<DateTime>)Convert.ToDateTime(o)));
            return result;
        }
        public Nullable<Boolean> ConvertNullBoolean(Object o)
        {
            Nullable<Boolean> result = (o == null ? null : (o.ToString().Length == 0 ? null : (Nullable<Boolean>)Convert.ToBoolean(o)));
            return result;
        }
        #endregion
    }
}
